<?php
include_once('common/header.php');	
if($AppUI->id <= 0 || !isset($_SERVER['HTTP_REFERER'])) {	
	$arrJson = array('error'=>1,'msg'=>$arrError[1]);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
	exit();
}
$intAjax	= $objRequest->getParam('aj', 0);
if($intAjax > 0) {
	$objURequest			= new URequest();
	$arrRequest				= $objURequest->getAll($AppUI->id);
	$arrData				= array();
	if($arrRequest) {
		foreach($arrRequest as $value) {
			$value['message']	= Zend_Json::decode($value['message']);
			$arrData[]			= $value;
		}
	}
	$this->view->ajax		= $intAjax;
	$this->view->arrRequest = $arrData;	
	$objURequest->updateRead($AppUI->id);
}
$objView 	= Zend_Registry::get('objView');
$strData	= $objView->fetch('ajax/request.tpl');
$arrJson 	= array('error'=>0,'msg'=>$strData);
echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
exit();
?>